﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="H2.NET.Web.Management.Account.Index" %>

<%@ Register src="../../UserControls/Pager.ascx" tagname="Pager" tagprefix="uc1" %>
<%@ Register src="../../UserControls/Toolbar.ascx" tagname="Toolbar" tagprefix="uc1" %>

<form id="pagerForm" onsubmit="return navTabSearch(this);" action="<%= Request.RawUrl %>"
method="post">
    <input type="hidden" name="pageNum" value="<%= PageNumber %>" />
    <input type="hidden" name="numPerPage" value="<%= PageSize %>" />
<div class="pageHeader">
    <div class="searchBar">
        <table class="searchContent">
            <tr>
                <td>
                    <label>
                        用户名：</label><input type="text" name="Username" id="Username" size="30" value="<%= Username %>" />
                </td>
            </tr>
        </table>
        <div class="subBar">
            <span class="info_clear">符合条件的记录，共有 <strong>
                <%= TotalItemCount %></strong>条。</span>
            <ul>
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit">
                                检索</button></div>
                    </div>
                </li>
                <li>
                    <div class="button">
                        <div class="buttonContent">
                            <button type="reset">
                                重置</button></div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
</div>
</form>
<form id="form1" runat="server">
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <uc1:Toolbar ID="Toolbar1" runat="server" />
        </ul>
    </div>
    <table class="table" width="100%" layouth="137">
        <thead>
            <tr>
                <th style="width: 5%;">
                    序号
                </th>
                <th align="center" style="width: 20%;">
                    用户名
                </th>
                <th align="center" style="width: 20%;">
                    最后登陆时间
                </th>
                <th align="center" style="width: 20%;">
                    最后登陆IP
                </th>
                <th style="width: 30%;">
                    角色
                </th>
                <th align="center" style="width: 5%;">
                    状态
                </th>
            </tr>
        </thead>
        <tbody>
            <asp:repeater id="rpt_users" runat="server" onitemdatabound="rpt_users_ItemDataBound">
        <ItemTemplate>
            <tr rel='<%# Eval("ID") %>' target="selectedId">
                <td class="fixedcol"><%# Container.ItemIndex + 1%></td>
                <td><%# Eval("Username")%></td>
                <td><%# Eval("LastLoginTime")%></td>
                <td><%# Eval("LastLoginIp")%></td>
                <td><asp:Literal runat="server" id="l_role" Text='<%# Eval("ID") %>'></asp:Literal></td>
                <td>
                    <asp:Literal runat="server" Text='<%# Eval("Status") %>' ID="l_status"></asp:Literal>
                </td>
            </tr> 
        </ItemTemplate>
    </asp:repeater>
        </tbody>
    </table>
</div>
<uc1:Pager ID="Pager1" runat="server" />
</form>
<script type="text/javascript">
    function AccountCreate(url, rel, title) {
        $.pdialog.open(url, rel, title, { width: 620, height: 300, mask: true });
        return false;
    }
    function AccountEdit(url, rel, title) {
        var id = $("#selectedId", navTab.getCurrentPanel()).val();
        if (!id) {
            alertMsg.warn("请先选择一条数据！");
            return false;
        }
        $.pdialog.open(url + "?id=" + id, rel, title, { width: 620, height: 300, mask: true });
        return false;
    }
    function AccountDelete(url, rel, title) {
        var id = $("#selectedId", navTab.getCurrentPanel()).val();
        if (!id) {
            alertMsg.warn("请先选择一条数据！");
            return false;
        }
        alertMsg.confirm(title, {
            okCall: function () {
                $.ajax({
                    type: 'POST',
                    url: url,
                    data: { id: id, title: title },
                    dataType: "json",
                    cache: false,
                    success: function (json) {
                        DWZ.ajaxDone(json);
                        navTabSearch($("#pagerForm", navTab.getCurrentPanel()));
                    },
                    error: DWZ.ajaxError
                });
            }
        });
        return false;
    }
    function AccountChangeStatus(url, rel, title) {
        var id = $("#selectedId", navTab.getCurrentPanel()).val();
        if (!id) {
            alertMsg.warn("请先选择一条数据！");
            return false;
        }
        alertMsg.confirm(title, {
            okCall: function () {
                $.ajax({
                    type: 'POST',
                    url: url,
                    data: { id: id, title: title },
                    dataType: "json",
                    cache: false,
                    success: function (json) {
                        DWZ.ajaxDone(json);
                        navTabSearch($("#pagerForm", navTab.getCurrentPanel()));
                    },
                    error: DWZ.ajaxError
                });

            }
        });
        return false;
    }
    function AccountSetRole(url, rel, title) {
        var id = $("#selectedId", navTab.getCurrentPanel()).val();
        if (!id) {
            alertMsg.warn("请先选择一条数据！");
            return false;
        }
        $.pdialog.open(url + "?id=" + id, rel, title, { width: 500, height: 350, mask: true });
        return false;
    }
</script>